package thread;

public class VolatileTest extends Thread{
    private boolean flag = false;
    private int count = 2;
    
    public void set(){
    	count = 1;
    	flag = true;
    }
    
    @Override
    public void run() {
    	if(flag){
    		int b = count + 1;
    		System.out.println(b);
    	}
    }

    public static void main(String[] a) {
    	VolatileTest test = new VolatileTest();
    	test.start();
    	test.set();
    }
}
